import WebUtils from './../../common/WebUtils';
import userConfig from '../../config/userConfig'

//common
const okexCommonWsUrl = userConfig.getOkexWebSocketUrl('common');
//c2c
const okexC2CWsUrl = userConfig.getOkexWebSocketUrl('c2c');
//spot
const okexSpotWsUrl = userConfig.getOkexWebSocketUrl('spot');

const config = {
    OkexCommonWebUtils: undefined,
    OkexC2CWebUtils: undefined,
    OkexSpotWebUtils: undefined
};


export default class OkexWebUtils {

    static okexCommonWebUtils() {
        if (!config.OkexCommonWebUtils) {
            config.OkexCommonWebUtils = new WebUtils(okexCommonWsUrl);
        }
        return config.OkexCommonWebUtils;
    }

    static okexC2CWebUtils() {
        if (!config.OkexC2CWebUtils) {
            config.OkexC2CWebUtils = new WebUtils(okexC2CWsUrl);
        }
        return config.OkexC2CWebUtils;
    }

    static okexSpotWebUtils() {
        if (!config.OkexSpotWebUtils) {
            config.OkexSpotWebUtils = new WebUtils(okexSpotWsUrl);
        }
        return config.OkexSpotWebUtils;
    }
};